<?php   

/**********************************************************
  @Author: Mohannad El-Barachi
  @Copyright: ICORPA 2011
  Validate Controller
  *********************************************************/
    
class ValidateController extends Zend_Controller_Action   
{   
	    function init()
	    {}
	    
	    function preDispatch() 
	    {}

	    public function indexAction()
	    {
	    	// Get the Pledge ID
	    	$pledge_id = $this->_request->getParam('pledge_id')/293028390;
	    		    	
	    	if ($pledge_id)
	    	{
		    	// Start the Pledges object
		    	$Pledge = new Pledges();
		    	
		    	// Check if the pledge_id exists
		    	if ($Pledge->get_pledge_details($pledge_id))
		    	{
			    	// Validate the pledge
			    	$Pledge->validate_pledge($pledge_id);
			    	$this->_redirect('pledges/'.$pledge_id.'/validated');
		    	}
		    	$this->_redirect('index');
	    	}
	    	$this->_redirect('index');
	    }
}

?>
